// https://leetcode-cn.com/problems/valid-parentheses/submissions/
#include <string>
#include <iostream>
#include <stack>

using namespace std;

class Solution {
public:
    bool isValid(string s) {
		int len = s.size();
		if(len % 2 != 0){
			return false;
		}
		int i = 0;
		stack<char> strStack;
		while(i < len){
			if(s[i] == ')' || s[i] == ']' || s[i] == '}'){
				if(strStack.empty()){
					return false;
				}
				string cp;
				cp += strStack.top();
				cp += s[i];
				if(cp == "()" || cp == "[]" || cp == "{}"){
					strStack.pop();
				}else{
					strStack.push(s[i]);
				}
			}else{
				strStack.push(s[i]);
			}
			i++;
		}
		return strStack.empty();
    }
};

int main(){
	string s = "()[]{}{[]}[]";
	Solution so;
	if(so.isValid(s)){
		cout << "yes" << endl;
	}else{
		cout << "no" << endl;
	}
	return 0;
}